/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thinkinginjava.svn.strings.regularexpressions;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author public_enemy
 */
public class TestRegularExpression {

    public static void main(String[] args) {

        if (args.length < 2) {
            System.out.println("Usage: \n java TestRegularExpression "
                    + "characterSequence regularExpression+ ");
            System.exit(0);
        }

        System.out.println("Inputs: \"" + args[0] + "\"");

        for (String arg : args) {
            System.out.println("Regular expression: \"" + arg + "\"");
            Pattern p = Pattern.compile(arg);
            Matcher m = p.matcher(args[0]);

            while (m.find()) {
                System.out.println("Match \"" + m.group() + "\" at positions " + m.start() + "-" + (m.end() - 1));
            }
        }
/*s+
s{4}
S{1}.
s{0,3}*/
    }
}
